package com.zygh.dlqwservice.module.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sun.org.apache.xpath.internal.operations.String;
import com.zygh.dlqwservice.common.domain.ResultBeans;
import com.zygh.dlqwservice.common.domain.ResultUtils;
import com.zygh.dlqwservice.module.entity.Special;
import com.zygh.dlqwservice.module.entity.Sptype;
import com.zygh.dlqwservice.module.mapper.SpecialMapper;
import com.zygh.dlqwservice.module.service.ISpecialService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lee
 * @since 2020-12-24
 */
@Service
public class SpecialServiceImpl extends ServiceImpl<SpecialMapper, Special> implements ISpecialService {
    @Resource
    private SpecialMapper specialMapper;

    /**
     *获取特殊勤务二级
     * @param sptype 封装参数
     * @return ResultBeans
     */
    @Override
    public ResultBeans getSpecial(Sptype sptype) {
        QueryWrapper<Special> wrapper = new QueryWrapper<>();
        wrapper.groupBy("sp.hierarchy","sp.hierarchy_name");
        wrapper.eq("sp.sptype_id",sptype.getType());
        List<Special> data = specialMapper.getSpecials(wrapper);
        return ResultUtils.resultBeansSuccess(data);
    }
}
